import { Button, Form } from "antd-mobile";
import React, { useEffect, useRef, useState } from "react";

const Demo6 = () => {
  // useRef
  // 1. 存储数据的容器,  （数据改变不会引起数据的更新）
  // 2. 获取页面的节点， 通过ref={值}  （必须是组件挂在就绪）
  // 3. 获取子组件的实例
  const count = useRef(1);
  const h3 = useRef(undefined);
  console.log(h3.current);

  useEffect(() => {
    console.log(h3.current);
  }, []);

  const form = Form.useForm()
  return (
    <div>
      <h1>Demo6</h1>

      <h3 ref={h3}>count: {count.current}</h3>

      <Button
        onClick={() => {
          count.current++;
          console.log(count.current);
        }}
      >
        +1
      </Button>


      <Form
        form={form}>

      </Form>
    </div>
  );
};

export default Demo6;
